<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
    <title>定时SQL</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta name="author" content="飞啊飘啊">
	<meta name="hashcode" content="-460746018">
	
	<script>window.duteTag="lz";</script>
	<script type="text/javascript" src="/admin/js/dute-1.0.js"></script>
	<script type="text/javascript" src="/admin/js/jquery-1.7.1.min.js"></script>
	
	<script type="text/javascript" src="/admin/js/lazy3q.ui.js"></script>
	<script>
		document.write('<link rel="stylesheet" type="text/css" href="/admin//css/'+($.cookie('theme')||'elegant')+'/lazy3q.ui.css" /> ');
	</script>
	
	<script type="text/javascript" src="/admin/js/jquery-ui-1.10.2.custom.min.js"></script>
	
	<!-- 用户自定义js(懒加载) -->
	<script type="text/javascript" src="/admin/js/define.js"></script>
	<!-- 用户自定义css样式 -->
	<link rel="stylesheet" type="text/css" href="/admin/css/define.css"/>
	<!-- icon font -->
  	<link rel="stylesheet" href="/admin/css/iconfont.css">
	
	
	
	<script type="text/javascript">
		window.basePath="/";
		window.hashcode = "-460746018";
	</script>
		
	<!-- 感谢kindeditor出品的在线HTML编辑控件 -->
	<script type="text/javascript" charset="utf-8" src="/admin/js/kindeditor/kindeditor.js"></script>
		
	<!-- 感谢My97DatePicker出品的时间控件 -->
	<script language="javascript" type="text/javascript" src="/admin/js/My97DatePicker/WdatePicker.js"></script>
	
	<!------------------------VIEW_HTML_HEAD------------------------>
	<!------------------------VIEW_HTML_HEAD------------------------>	
	
</head>
<script>
Page({
  data:{
    
  },
  onLoad: function(options) {
  	var THIS = this;
  	THIS.setData(options);
  	$.getAjax("srvsql.get.do",options,function(protocol){
  		if(protocol.message){
  			$.toast(protocol.message);
  		}
  		document.title={
  			 "insert":"创建定时SQL"
  			,"inport":"导入定时SQL"
  			,"update":"修改定时SQL"
  			,"detail":"定时SQL详情"
  		}[options.edittype];
  		THIS.setData(protocol.data); 
  		/******************VIEW_HTML_SET_DATA******************/
  		/******************VIEW_HTML_SET_DATA******************/
  	});
  }
});
</script>
<script>
window["lzFlashUrl"]=top.lzFlashUrl||"/admin/flash/";
window["uploadUrl"]=top.uploadUrl||"/admin/upload.do";

$(function(){
		 
	$("#srvsqlForm").form({
		"":function(){}
		,"srvSql.ssId":function(el){
			if($(el).parents("dd:eq(0)").find("b:contains('*')").size()>0){
			}
		}
		,"srvSql.ssName":function(el){
			if($(el).parents("dd:eq(0)").find("b:contains('*')").size()>0){
				if(jQuery.trim(el.value)=="")
					return "名称不能为空";
			}
			if(el.value.length>32 && el.value.indexOf("[*]")==-1)
				return "名称最大长度为32个字符";
		}
		,"srvSql.ssSql":function(el){
			if($(el).parents("dd:eq(0)").find("b:contains('*')").size()>0){
				if(jQuery.trim(el.value)=="")
					return "SQL语句不能为空";
			}
			if(el.value.length>4096 && el.value.indexOf("[*]")==-1)
				return "SQL语句最大长度为4096个字符";
		}
		,"srvSql.ssInterval":function(el){
			if($(el).parents("dd:eq(0)").find("b:contains('*')").size()>0){
				if(jQuery.trim(el.value)=="")
					return "时间间隔不能为空";
			}
				if(el.value.length>10)
					return "数字太大了";
					 var pattern = /^-?(0|[1-9][0-9]*)?$/;
					 if(!pattern.test(el.value))
						return "请输入正确格式的数字";			
		}
		,"srvSql.ssLast":function(el){
		}
		,"srvSql.ssUpdateTime":function(el){
			if($(el).parents("dd:eq(0)").find("b:contains('*')").size()>0){
				if(jQuery.trim(el.value)=="")
					return "修改时间不能为空";
			}
		}
		,"srvSql.ssAddTime":function(el){
			if($(el).parents("dd:eq(0)").find("b:contains('*')").size()>0){
				if(jQuery.trim(el.value)=="")
					return "添加时间不能为空";
			}
		}
		,"srvSql.ssStatus":function(el){
			if($(el).parents("dd:eq(0)").find("b:contains('*')").size()>0){
				if(jQuery.trim(el.value)=="")
					return "请选择状态";
			}
		}
	},function(){
		/******************************LAZY3Q_FORM_VALIDATE******************************/
		/******************************LAZY3Q_FORM_VALIDATE******************************/
	});		
});
</script>

<body style="display:none;">



<!------------------------VIEW_HTML_TOP------------------------>
<!------------------------VIEW_HTML_TOP------------------------>


<form enctype="{{inports!=null?'multipart/form-data':''}}" lz:if="{{edittype=='insert'||edittype=='update'||edittype=='detail'||edittype=='any'||edittype=='inport'}}" class="form editform edittype_{{edittype}}" ref="SrvSql" id="srvsqlForm" name="srvsqlForm" target="jsoniframe" action="srvsql.{{edittype=='any'?'update':edittype}}.do" method="post">
	<div class="head"></div>
	<div class="body">
		<div class="content">
			<div lz:if="{{edittype!='detail'}}" class="prompt">
				温馨提示：请仔细填写定时SQL相关信息，<span class="extrude">"*" 为必填选项。</span>
			</div>
			<br/>
			<lz:block lz:if="{{message}}">
			<br/>
			<center>
				<font color="red"><h4>{{message}}</h4></font>
			</center>
			<br/>
			</lz:block>
			<input type="hidden" value="{{complete}}" name="complete" id="complete" />
			<input type="hidden" value="{{ids}}" name="ids" id="ids" />
			<textarea name="PARAMS" id="PARAMS" style="display:none">{{PARAMS}}</textarea>
			
			
			<lz:block lz:if="{{inports}}">
			  <div class="line"></div>
			  <dl style="width:98%;">
			  	<dt>Excel文件:</dt>
			  	<dd>
			  		<input type="hidden" value="{{inports}}" name="inports" id="inports" />
			  		<input type="hidden" value="{{inport$}}" name="inport$" id="inport$" />
			  		<input name="file" name="file" type="file"/>
			  		<b>*</b>
			  		<div>
						请上传excel文件，表格列依次为：[{{inport$}}]，excel表格第一行为列名称，将不作为上传数据行
					</div>
			  	</dd>
			  </dl>
			  <div class="line"></div>
			</lz:block>
	{{lz.set("ssId_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssId"))))&&true)||(edittype=='update'&&true)||((edittype=='any')&&(lz.idin(fields,"ssId"))))}}
	{{lz.set("ssId_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssId}}
	<dl lz:if="{{ssId_editable||ssId_readonly}}" class="ssId hidden " major  ref="ssId">
		<dt>编　　号:</dt>
		<dd lz:if="{{ssId_editable}}" input="hidden">
			<lz:block lz:if="{{srvSql$ssId}}">
				{{srvSql$ssId}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssId}}">
			<input type="hidden" value="{{lz.htm(srvSql.ssId)}}" name="srvSql.ssId" id="ssId" />
	 	 </lz:block>
	 	 
	 	 <em></em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssId_readonly}}">
		 	<div class="state-input narrow">
		 		<textarea class=""  style="display:none;" id="ssId">{{srvSql.ssId}}</textarea>
		 		<span>
		 	
			 {{lz.html(srvSql.ssId$||srvSql.ssId)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssId}}
	{{lz.set("ssName_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssName"))))&&true)||(edittype=='update'&&true)||((edittype=='any')&&(lz.idin(fields,"ssName"))))}}
	{{lz.set("ssName_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssName}}
	<dl lz:if="{{ssName_editable||ssName_readonly}}" class="ssName  " major  ref="ssName">
		<dt>名　　称:</dt>
		<dd lz:if="{{ssName_editable}}" input="text">
			<lz:block lz:if="{{srvSql$ssName}}">
				{{srvSql$ssName}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssName}}">
		 	<input type="text" class="input narrow"   name="srvSql.ssName" id="ssName"  value="{{lz.htm(srvSql.ssName)}}"/>
	 	 </lz:block>
	 	 <b>*</b>
	 	 <em>请输入定时SQL的名称</em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssName_readonly}}">
		 	<div class="state-input narrow">
		 		<textarea class=""  style="display:none;" id="ssName">{{srvSql.ssName}}</textarea>
		 		<span>
		 	
			 {{lz.html(srvSql.ssName$||srvSql.ssName)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssName}}
	{{lz.set("ssSql_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssSql"))))&&true)||(edittype=='update'&&true)||((edittype=='any')&&(lz.idin(fields,"ssSql"))))}}
	{{lz.set("ssSql_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssSql}}
	<dl lz:if="{{ssSql_editable||ssSql_readonly}}" class="ssSql   wider" major  ref="ssSql">
		<dt>SQL语句:</dt>
		<dd lz:if="{{ssSql_editable}}" input="textarea">
			<lz:block lz:if="{{srvSql$ssSql}}">
				{{srvSql$ssSql}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssSql}}">
		 	<textarea class="input wide"  id="ssSql" name="srvSql.ssSql" rows="5">{{srvSql.ssSql}}</textarea>
	 	 </lz:block>
	 	 <b>*</b>
	 	 <em>请输入定时SQL的SQL语句</em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssSql_readonly}}">
		 	<div class="state-input wide">
		 		<span>
		 	
			 {{lz.html(srvSql.ssSql$||srvSql.ssSql)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssSql}}
	{{lz.set("ssInterval_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssInterval"))))&&true)||(edittype=='update'&&true)||((edittype=='any')&&(lz.idin(fields,"ssInterval"))))}}
	{{lz.set("ssInterval_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssInterval}}
	<dl lz:if="{{ssInterval_editable||ssInterval_readonly}}" class="ssInterval  " major  ref="ssInterval">
		<dt>时间间隔:</dt>
		<dd lz:if="{{ssInterval_editable}}" input="number">
			<lz:block lz:if="{{srvSql$ssInterval}}">
				{{srvSql$ssInterval}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssInterval}}">
			<input onkeyup="var reg=/^-?(([1-9]\d{0,9})|0)?/;this.value=this.value.match(reg)?this.value.match(reg)[0]:''" type="text" class="input narrow"  maxlength="8" name="srvSql.ssInterval" id="ssInterval"  value="{{lz.htm(srvSql.ssInterval)}}"/>
	 	 </lz:block>
	 	 <b>*</b>
	 	 <em>秒为单位</em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssInterval_readonly}}">
		 	<div class="state-input narrow">
		 		<textarea class=""  style="display:none;" id="ssInterval">{{srvSql.ssInterval}}</textarea>
		 		<span>
		 	
			 {{lz.html(srvSql.ssInterval$||srvSql.ssInterval)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssInterval}}
	{{lz.set("ssLast_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssLast"))))&&true)||(edittype=='update'&&true)||((edittype=='any')&&(lz.idin(fields,"ssLast"))))}}
	{{lz.set("ssLast_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssLast}}
	<dl lz:if="{{ssLast_editable||ssLast_readonly}}" class="ribs ssLast  " major  ref="ssLast">
		<dt>上次执行:</dt>
		<dd lz:if="{{ssLast_editable}}" input="datetime">
			<lz:block lz:if="{{srvSql$ssLast}}">
				{{srvSql$ssLast}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssLast}}">
		 	<input onchange="void(0);" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text" class="datetime input narrow" maxlength="19" name="srvSql.ssLast" id="ssLast"  value="{{srvSql.ssLast$}}"/>
	 	 </lz:block>
	 	 
	 	 <em>请选择定时SQL的上次执行</em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssLast_readonly}}">
		 	<div class="state-input narrow">
		 		<textarea class=""  style="display:none;" id="ssLast">{{srvSql.ssLast}}</textarea>
		 		<span>
		 	
			 {{lz.html(srvSql.ssLast$||srvSql.ssLast)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssLast}}
	{{lz.set("ssUpdateTime_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssUpdateTime"))))&&false)||(edittype=='update'&&false)||((edittype=='any')&&(lz.idin(fields,"ssUpdateTime"))))}}
	{{lz.set("ssUpdateTime_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssUpdateTime}}
	<dl lz:if="{{ssUpdateTime_editable||ssUpdateTime_readonly}}" class="ssUpdateTime  " major  ref="ssUpdateTime">
		<dt>修改时间:</dt>
		<dd lz:if="{{ssUpdateTime_editable}}" input="datetime">
			<lz:block lz:if="{{srvSql$ssUpdateTime}}">
				{{srvSql$ssUpdateTime}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssUpdateTime}}">
		 	<input onchange="void(0);" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text" class="datetime input narrow" maxlength="19" name="srvSql.ssUpdateTime" id="ssUpdateTime"  value="{{srvSql.ssUpdateTime$}}"/>
	 	 </lz:block>
	 	 <b>*</b>
	 	 <em>请选择定时SQL的修改时间</em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssUpdateTime_readonly}}">
		 	<div class="state-input narrow">
		 		<textarea class=""  style="display:none;" id="ssUpdateTime">{{srvSql.ssUpdateTime}}</textarea>
		 		<span>
		 	
			 {{lz.html(srvSql.ssUpdateTime$||srvSql.ssUpdateTime)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssUpdateTime}}
	{{lz.set("ssAddTime_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssAddTime"))))&&false)||(edittype=='update'&&false)||((edittype=='any')&&(lz.idin(fields,"ssAddTime"))))}}
	{{lz.set("ssAddTime_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssAddTime}}
	<dl lz:if="{{ssAddTime_editable||ssAddTime_readonly}}" class="ssAddTime  " major  ref="ssAddTime">
		<dt>添加时间:</dt>
		<dd lz:if="{{ssAddTime_editable}}" input="datetime">
			<lz:block lz:if="{{srvSql$ssAddTime}}">
				{{srvSql$ssAddTime}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssAddTime}}">
		 	<input onchange="void(0);" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text" class="datetime input narrow" maxlength="19" name="srvSql.ssAddTime" id="ssAddTime"  value="{{srvSql.ssAddTime$}}"/>
	 	 </lz:block>
	 	 <b>*</b>
	 	 <em>请选择定时SQL的添加时间</em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssAddTime_readonly}}">
		 	<div class="state-input narrow">
		 		<textarea class=""  style="display:none;" id="ssAddTime">{{srvSql.ssAddTime}}</textarea>
		 		<span>
		 	
			 {{lz.html(srvSql.ssAddTime$||srvSql.ssAddTime)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssAddTime}}
	{{lz.set("ssStatus_editable",((edittype=='insert'||(edittype=='inport' && (!lz.idin(inports,"ssStatus"))))&&true)||(edittype=='update'&&true)||((edittype=='any')&&(lz.idin(fields,"ssStatus"))))}}
	{{lz.set("ssStatus_readonly",(edittype=='insert'&&false)||(edittype=='update'&&false)||(edittype=='detail'))}}
	
	{{before$ssStatus}}
	<dl lz:if="{{ssStatus_editable||ssStatus_readonly}}" class="ssStatus  " major  ref="ssStatus">
		<dt>状　　态:</dt>
		<dd lz:if="{{ssStatus_editable}}" input="select">
			<lz:block lz:if="{{srvSql$ssStatus}}">
				{{srvSql$ssStatus}}
			</lz:block>
			<lz:block lz:if="{{!srvSql$ssStatus}}">
		 	<select class="narrow" id="ssStatus" name="srvSql.ssStatus">
		 		<option value="">请选择</option>
				<option value="1" selected='{{srvSql.ssStatus=="1"?"selected":""}}'>正常</option>
				<option value="0" selected='{{srvSql.ssStatus=="0"?"selected":""}}'>无效</option>
		 	</select>
	 	 </lz:block>
	 	 <b>*</b>
	 	 <em>请选择定时SQL的状态</em> 
	 	 <a class="mui-navigate-right"></a>
		</dd>
		<dd lz:if="{{ssStatus_readonly}}">
		 	<div class="state-input narrow">
		 		<textarea class=""  style="display:none;" id="ssStatus">{{srvSql.ssStatus}}</textarea>
		 		<span>
		 	
			 {{lz.html(srvSql.ssStatus$||srvSql.ssStatus)}}
	 	 		</span>
	 	 	</div>
		</dd>
	</dl>
	{{after$ssStatus}}
			
			
			<div class="line">
				<center lz:if="{{edittype=='insert'}}">
					<a onclick="$('.ribs').show();window.fireResize();$('.ribs-handle').toggle();" href="javascript:void(0);" class="state-content ribs-handle" style="display:inline;padding: 0px 15px;">点击展开更多编辑项</a>
					<a onclick="$('.ribs').hide();window.fireResize();$('.ribs-handle').toggle();" href="javascript:void(0);" class="state-content ribs-handle" style="display:none;padding: 0px 15px;">点击收起更多编辑项</a>
				</center>
			</div>
			<center class="buttons">
				<input type="hidden" value="{{srvSql.ssId}}" name="srvSql.ssId" id="ssId" />
			
			<lz:block lz:if="{{edittype=='insert'||edittype=='update'||edittype=='any'||edittype=='inport'}}">
				<button class="button" type="submit">
					&nbsp;<img class="iconA" align="absmiddle" width="20" src="/admin/images/icons/Badge-tick.png"/>
					<span class="iconB iconfont icon-weibiaoti8"></span>
					保存&nbsp;&nbsp;</button>
				<button title="不保存数据,关闭窗口,不刷新原列表" class="button" onclick="cancel();" type="button">
					&nbsp;<img class="iconA" align="absmiddle" width="20" src="/admin/images/icons/Badge-multiply.png"/>
					<span class="iconB iconfont icon-icon11"></span>
					关闭&nbsp;&nbsp;</button>
			</lz:block>
			
			<lz:block lz:if="{{edittype=='detail'}}">
				<button lz:if="{{canEdit}}" type="button" class="button" onclick='window.location.href="/admin/systematic/srvsql.edit.html?edittype=update&id={{srvSql.id}}"'>
					&nbsp;<img class="iconA" align="absmiddle" width="20" src="/admin/images/icons/Badge-tick.png"/>
					<span class="iconB iconfont icon-weibiaoti8"></span>
					修改&nbsp;&nbsp;</button>
				<button lz:if="{{canDel}}" type="button" class="button" onclick="deleteSrvsql('{{srvSql.id}}','{{srvSql.ssName}}')">
					&nbsp;<img class="iconA" align="absmiddle" width="20" src="/admin/images/icons/Badge-multiply.png"/>
					<span class="iconB iconfont icon-icon11"></span>
					删除&nbsp;&nbsp;</button>
				<button title="不保存数据,关闭窗口,不刷新原列表" class="button" onclick="cancel();" type="button">
					&nbsp;<img class="iconA" align="absmiddle" width="20" src="/admin/images/icons/Badge-multiply.png"/>
					<span class="iconB iconfont icon-icon11"></span>
					关闭&nbsp;&nbsp;</button>
			</lz:block>
					
			</center>
			<br/>

		</div>
	</div>
	<div class="foot"></div>		
</form>

 


<!------------------------VIEW_HTML_BOTTOM------------------------>
<!------------------------VIEW_HTML_BOTTOM------------------------>


</body>

<!------------------------VIEW_HTML_FOOTER------------------------>
<!------------------------VIEW_HTML_FOOTER------------------------>
<script>
	
	$(function(){
		if(parent.setit){
			parent.setit("/admin/systematic/srvsql.edit.html",document.title,"/admin//images/icons/Console.png");
		}
	});
	
	function cancel(){
		if(parent.closeHref){
			parent.closeHref("/admin/systematic/srvsql.edit.html");
		}else{
			$.closeModalDialog();
		}
	}


	/**
	* 删除定时SQL
	**/
	function deleteSrvsql(id,flag)
	{
		var dialog=top.$.dialog({
				html:"<span style='white-space:nowrap;'>确定要删除当前数据吗？</span>",
				title:"删除定时SQL",
				modal: true,			
				onOk:function(){
					dialog.closeDialog();
					var url = "/admin/systematic/srvsql.delete.do";
					var params = {id:id};
					var protocol = $.getAjax(url,params);
					if(protocol.message){
						top.$.toast(protocol.message);
					}
					if(protocol.success){
						caller.location.href=caller.location.href;		
					}
				}
		 });	
	}
</script>
</html>